<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>1-符合条件的数组成员find</title>
</head>
<body>
    <script>
        //find方法返回的一个数组成员
        var arr = [
            {
                uid:1,
                username:'刘德华',
                age:60
            },
            {
                uid:2,
                username:'张学友',
                age:55
            },
            {
                uid:3,
                username:'罗永浩',
                age:50
            },            
        ];
        //把uid=2的查出来
        var target1 = arr.find(function(val){
            //console.log(val);
            return val.uid ==2;
        });
        console.log(target1);
        var target2 = arr.find((val)=>{
            return val.uid ==2;
        });


    </script>
</body>
</html>